package com.ruoyi.web.controller.wq;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.web.service.TaskService;
import com.ruoyi.wq.domain.WqTask;
import com.ruoyi.wq.domain.vo.WqTaskVO;

/**
 * 任务Controller
 * 
 * @author ruoyi
 * @date 2024-05-08
 */
@RestController
@RequestMapping("/wq/task")
public class WqTaskController extends BaseController {

    @Autowired
    private TaskService taskService;

    /**
     * 查询任务列表
     */
    @GetMapping("/list")
    public AjaxResult list(WqTaskVO wqTask) {
    	wqTask.setUserId(SecurityUtils.getUserId());
        List<WqTask> list = taskService.getTaskList(wqTask);
        return AjaxResult.success(list);
    }
    
    /**
     * 任务完成
     */
    @PostMapping("/ok")
    public AjaxResult ok(@RequestBody WqTaskVO wqTask){
    	wqTask.setUserId(SecurityUtils.getUserId());
    	List<WqTask> list = taskService.TaskOk(wqTask);
        return AjaxResult.success(list);
    }

}
